package com.sanjiahantang.youjiarole.module.common.holders;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.Paint;
import android.os.Bundle;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.view.Gravity;
import android.view.View;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.RatingBar;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.sanjiahantang.uilibrary.adapter.listview.BaseAdapterHelper;
import com.sanjiahantang.uilibrary.adapter.listview.QuickAdapter;
import com.sanjiahantang.uilibrary.utils.Utils;
import com.sanjiahantang.uilibrary.views.MyGridView;
import com.sanjiahantang.uilibrary.views.bannerview.BannerView;
import com.sanjiahantang.youjiarole.R;
import com.sanjiahantang.youjiarole.base.BaseApplication;
import com.sanjiahantang.youjiarole.base.BaseView;
import com.sanjiahantang.youjiarole.base.CallBack;
import com.sanjiahantang.youjiarole.config.ConfigValue;
import com.sanjiahantang.youjiarole.config.SPConfig;
import com.sanjiahantang.youjiarole.config.StaticValue;
import com.sanjiahantang.youjiarole.module.article.views.impl.ArticleTypeListActivity;
import com.sanjiahantang.youjiarole.module.common.adapters.ImageAddAdapter;
import com.sanjiahantang.youjiarole.module.common.beans.HomeBean;
import com.sanjiahantang.youjiarole.module.common.beans.StringBean;
import com.sanjiahantang.youjiarole.module.common.views.impl.MainActivity;
import com.sanjiahantang.youjiarole.module.common.views.impl.WebActivity;
import com.sanjiahantang.youjiarole.module.evaluate.beans.EvaGoodsBean;
import com.sanjiahantang.youjiarole.module.evaluate.beans.GoodsAppraiseInitResponse;
import com.sanjiahantang.youjiarole.module.evaluate.views.impl.EVAGoodsListActivity;
import com.sanjiahantang.youjiarole.module.goods.adapters.GoodsListAdapter;
import com.sanjiahantang.youjiarole.module.goods.beans.GoodsBean;
import com.sanjiahantang.youjiarole.module.goods.views.impl.GoodsDetailActivity;
import com.sanjiahantang.youjiarole.module.match.beans.MatchBean;
import com.sanjiahantang.youjiarole.module.me.order.beans.OrderTakeResponseBean;
import com.sanjiahantang.youjiarole.module.me.require.models.IRequireModel;
import com.sanjiahantang.youjiarole.module.me.require.models.impl.RequireModel;
import com.sanjiahantang.youjiarole.module.me.require.views.impl.RequireDetailActivity;
import com.sanjiahantang.youjiarole.umengshare.UmengShareManager;
import com.sanjiahantang.youjiarole.utils.FileUtils;
import com.sanjiahantang.youjiarole.utils.RelativeDateFormat;
import com.sanjiahantang.youjiarole.utils.SPUtils;
import com.squareup.picasso.Picasso;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import q.rorbin.badgeview.QBadgeView;

/**
 * Created by zy on 2017/10/18.
 */

public class CommonHolder extends RecyclerView.ViewHolder implements StaticValue{

    private View itemView;
    private int resIds[];
    private IRequireModel requireModel;

    public CommonHolder(Activity activity, View itemView, int viewType, Object data) {
        super(itemView);
        this.itemView = itemView;
        bindData(activity,viewType,data);
        resIds = new int[]{
                R.drawable.i_rect_bg2,
                R.drawable.i_rect_bg3,
                R.drawable.i_rect_bg,

        };

        requireModel = new RequireModel();
    }

    public void bindData(Activity activity, int viewType, Object data){
        switch (viewType){
            case HOLDER_TYPE_GOODS_BANNER:
                initGoodsBanner(activity,itemView,data);
                break;
            case HOLDER_TYPE_GOODS_DETAIL:
                initGoodsDetail(itemView,(Object[])data);
                break;
            case HOLDER_TYPE_MATCH_HEADER:
                initMatchHeader(activity,itemView,(String) data);
                break;
            case HOLDER_TYPE_GOODS_WEBVIEW:
                initWeb(itemView,(String) data);
                break;
            case HOLDER_TYPE_GOODS_RECOMMEND:
                initRecommend(activity,itemView, (List<MatchBean.Goods>) data,-1);
                break;
            case HOLDER_TYPE_GOODS_RECOMMEND_MORE:
                initRecommend(activity,itemView, (List<MatchBean.Goods>) data);
                break;
            case HOLDER_TYPE_MATCH_RECOMMEND:
                initRecommend(activity,itemView, (List<MatchBean.Goods>) data,1);
                break;
            case HOLDER_TYPE_GOODS_COMMENTS:
                initGoodsComments(activity,itemView,(List<EvaGoodsBean.Item>)data);
                break;
            case HOLDER_TYPE_EVALUATE_GOODS:
                initEvaluateGoods(activity,itemView,(Object[])data);
                break;
            case HOLDER_TYPE_ARTICLE:
                initMainPageArticle(activity,itemView,(List<HomeBean.Article>)data);
                break;
            case HOLDER_TYPE_TAKE_ORDER:
                initMainOrderTake(activity,itemView,(List<OrderTakeResponseBean.Data>)data);
                break;
            default:
                defaultView();
                break;
        }
    }

    private void initMainOrderTake(final Activity activity, View itemView, final List<OrderTakeResponseBean.Data> data) {
        //由于需求变动 改成固定3个item
        MyGridView gridView = (MyGridView) itemView;
        List<OrderTakeResponseBean.Data> newData = new ArrayList<>();
        if (data != null){
            if (data.size() > 3){
                newData = data.subList(0,3);
            }else{
                newData = data;
            }
        }

        gridView.setAdapter(new QuickAdapter<OrderTakeResponseBean.Data>(activity,R.layout.item_main_order_take,newData) {
            @Override
            protected void convert(BaseAdapterHelper helper, final OrderTakeResponseBean.Data item) {
                helper.setText(R.id.txtApartName,item.getApartmentName());
                helper.setText(R.id.txtName,item.getUserName());
                String city = item.getAddress();
                if (city != null){
                    if (city.contains(" ")){
                        city = city.split(" ")[0];
                    }
                }else{
                    city = "";
                }
                helper.setText(R.id.txtCity,city);

                helper.getView().setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {

                        if (item.getIsBidProject() == 1 && (item.getStateName() != null && item.getStateName().contains("设计师"))){
                            findBidRequireInfoForRole(context,item.getId(), new BaseView.OnLoadListener() {
                                @Override
                                public void onLoad(Object content) {
                                    Intent intent = new Intent(context, RequireDetailActivity.class);
                                    intent.putExtra(KEY_ID,item.getId());
                                    intent.putExtra("state",3);
                                    intent.putExtra("type",0);
                                    context.startActivity(intent);
                                }
                            });
                        }else{
                            int type = -1;
                            if (item.getStateName().contains("设计师")){
                                type = 0;
                            }else if(item.getStateName().contains("项目经理")){
                                type = 1;
                            }else if(item.getStateName().contains("监理")){
                                type = 2;
                            }
                            String role = SPUtils.get(context,SPConfig.ROLE_ID,"").toString();
                            if (role.contains(String.valueOf(type))){
                                Intent intent = new Intent(context, RequireDetailActivity.class);
                                intent.putExtra(KEY_ID,item.getId());
                                intent.putExtra("state", 2);
                                intent.putExtra("type",type);
                                context.startActivity(intent);
                            }
                        }

                    }
                });

                ImageView imgBg = helper.getView(R.id.imgBg);
                imgBg.setImageResource(resIds[helper.getPosition() % 3]);
            }
        });
        /*MagicIndicator indicator = itemView.findViewById(R.id.hl);
        CommonNavigator navigator = new CommonNavigator(activity);
        if (data == null || data.size() == 0){
            indicator.setVisibility(View.GONE);
        }
        CommonNavigatorAdapter adapter = new CommonNavigatorAdapter() {
            @Override
            public int getCount() {
                return data == null ? 0 : data.size();
            }

            @Override
            public IPagerTitleView getTitleView(final Context context, final int index) {
                CommonPagerTitleView commonPagerTitleView = new CommonPagerTitleView(context);
                View contentView = LayoutInflater.from(context).inflate(R.layout.item_main_order_take,null);
                commonPagerTitleView.setContentView(contentView);
                final OrderTakeResponseBean.Data item = data.get(index);
                final TextView txtApartName = contentView.findViewById(R.id.txtApartName);
                txtApartName.setText(item.getApartmentName());
                TextView txtName = contentView.findViewById(R.id.txtName);
                txtName.setText(item.getUserName());
                TextView txtCity = contentView.findViewById(R.id.txtCity);
                txtCity.setText(item.getAddress());

                commonPagerTitleView.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        int type = -1;
                        if (item.getStateName().contains("设计师")){
                            type = 0;
                        }else if(item.getStateName().contains("项目经理")){
                            type = 1;
                        }else if(item.getStateName().contains("监理")){
                            type = 2;
                        }
                        String role = SPUtils.get(context,SPConfig.ROLE_ID,"").toString();
                        if (role.contains(String.valueOf(type))){
                            Intent intent = new Intent(context, RequireDetailActivity.class);
                            intent.putExtra(KEY_ID,item.getId());
                            intent.putExtra("state", 2);
                            intent.putExtra("type",type);
                            context.startActivity(intent);
                        }
                    }
                });
                return commonPagerTitleView;
            }

            @Override
            public IPagerIndicator getIndicator(Context context) {
                return null;
            }
        };
        navigator.setAdapter(adapter);
        indicator.setNavigator(navigator);
        RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,Utils.dip2px(activity,120));
        indicator.setLayoutParams(layoutParams);*/
    }

    private void findBidRequireInfoForRole(final Context context, int id, final BaseView.OnLoadListener listener) {
        Map<String,String> param = new HashMap<>();
        param.put(KEY_TOKEN,ConfigValue.DATA_KEY);
        param.put("ucriId",String.valueOf(id));
        requireModel.findBidRequireInfoForRole(context,param, new CallBack<StringBean>() {
            @Override
            public void onSuccess(StringBean response, Context context, Object tag) {
                if (response != null && response.getCode() == RESPONSE_CODE_SUC){
                    if (response.getData() != null && response.getData().contains("true")){
                        listener.onLoad(null);
                    }else if (response.getData() != null && response.getData().contains("false")){
                        Utils.showToast(context,"温馨提示，投标人数已满");
                    }else {
                        Utils.showToast(context,"服务器开小差了");
                    }
                }else if (response != null){
                    Utils.showToast(context,response.getMessage());
                }else{
                    Utils.showToast(context,"服务器开小差了");
                }
            }

            @Override
            public void onFailure(String message) {
                Utils.showToast(context,"服务器开小差了");
            }
        });
    }


    private void initMainPageArticle(final Activity activity, View itemView, List<HomeBean.Article> data) {
        TextView tv_type = (TextView) itemView.findViewById(R.id.tv_type);
        tv_type.setText("培训中心");
        TextView tv_comprehensive_en = (TextView) itemView.findViewById(R.id.tv_comprehensive_en);
        tv_comprehensive_en.setText("Match Center");
        ListView lv_comoerhensive = (ListView) itemView.findViewById(R.id.lv_comoerhensive);
        itemView.findViewById(R.id.tv_more).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                activity.startActivity(new Intent(activity, ArticleTypeListActivity.class));
            }
        });
        lv_comoerhensive.setAdapter(new QuickAdapter<HomeBean.Article>(activity,R.layout.item_article,data) {
            @Override
            protected void convert(BaseAdapterHelper helper, final HomeBean.Article item) {
                helper.setText(R.id.txtTitle,item.getArTitle());
                ImageView ivIcon = helper.getView(R.id.ivIcon);
                if (!TextUtils.isEmpty(item.getUrl())){
                    Picasso.with(context).load(FileUtils.rePath(item.getUrl())).placeholder(R.drawable.i_rect_bg).into(ivIcon);
                }else{
                    ivIcon.setImageResource(R.drawable.i_rect_bg);
                }

                try {
                    SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
                    Date date = df.parse(item.getCreateTime());
                    helper.setText(R.id.txtTime, RelativeDateFormat.format(date));
                } catch (ParseException e) {
                    e.printStackTrace();
                }

                helper.getView().setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        Intent intent = new Intent(context, WebActivity.class);
                        intent.putExtra(KEY_ID,item.getArticleNo());
                        intent.putExtra(KEY_TYPE,WEB_TYPE_MATCH_CENTER);
                        context.startActivity(intent);
                    }
                });

                if (helper.getPosition() == data.size() - 1){
                    helper.setVisible(R.id.bottomLine,false);
                }else{
                    helper.setVisible(R.id.bottomLine,true);
                }

            }
        });

        itemView.findViewById(R.id.rootView).setPadding(0,0,0, Utils.dip2px(activity,40));
    }

    //商品评价
    private void initEvaluateGoods(Activity activity, View itemView, Object[] param) {
        GoodsAppraiseInitResponse.Data data = (GoodsAppraiseInitResponse.Data) param[0];
        BaseView.OnLoadListener listener = (BaseView.OnLoadListener) param[1];
        TextView txtGoodsName = (TextView) itemView.findViewById(R.id.txtGoodsName);
        ImageView ivGoodsImage = (ImageView) itemView.findViewById(R.id.ivGoodsImage);
        txtGoodsName.setText(data.getGoodsName());
        Picasso.with(activity).load(FileUtils.rePath(data.getUrl())).into(ivGoodsImage);

        MyGridView gvGoodsEvaluate = (MyGridView) itemView.findViewById(R.id.gvGoodsEvaluate);
        gvGoodsEvaluate.setAdapter(new ImageAddAdapter(activity,param));
    }


    private void defaultView() {

    }

    private void initGoodsComments(final Activity activity, View itemView, final List<EvaGoodsBean.Item> data) {
        TextView txtCommentCount = (TextView) itemView.findViewById(R.id.txtCommentCount);
        txtCommentCount.setText(String.valueOf(data == null ? 0 : data.size()));
        if (data == null || data.size() == 0){
            itemView.findViewById(R.id.itemComment).setVisibility(View.GONE);
            itemView.findViewById(R.id.txtCommentMore).setVisibility(View.GONE);
            return;
        }
        TextView txtPhone = (TextView) itemView.findViewById(R.id.txtPhone);
        txtPhone.setText(data.get(0).getPhone().replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2"));

        TextView txtCreateTime = (TextView) itemView.findViewById(R.id.txtCreateTime);
        txtCreateTime.setText(data.get(0).getCreateTime().substring(0,"yyyy-MM-dd".length()));

        TextView txtAttr = (TextView) itemView.findViewById(R.id.txtAttr);
        if (data.get(0).getGoodsPropertyName() != null)
            txtAttr.setText(data.get(0).getGoodsPropertyName().replace(","," "));


        RatingBar ratingBar = (RatingBar) itemView.findViewById(R.id.ratingBar);
        ratingBar.setRating(Integer.parseInt(data.get(0).getNumber()));
        ratingBar.setIsIndicator(true);
        GridView gvImageList = (GridView) itemView.findViewById(R.id.gvImageList);
        if (data.get(0).getImgUrlList() == null || data.get(0).getImgUrlList().size() == 0){
            gvImageList.setVisibility(View.GONE);
        }else{
            gvImageList.setVisibility(View.VISIBLE);
            gvImageList.setAdapter(new com.sanjiahantang.uilibrary.adapter.listview.QuickAdapter<GoodsBean.Image>(activity,R.layout.item_image,data.get(0).getImgUrlList()) {
                @Override
                protected void convert(com.sanjiahantang.uilibrary.adapter.listview.BaseAdapterHelper helper, final GoodsBean.Image item) {
                    ImageView iv = helper.getView(R.id.image);
                    Picasso.with(context).load(FileUtils.rePath(item.getUrl())).placeholder(R.drawable.i_rect_bg).into(iv);
                    helper.getView().setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            Utils.showPicDialog((Activity) context,FileUtils.rePath(item.getUrl()),R.drawable.i_rect_bg);
                        }
                    });
                }
            });
        }
        if (data.size() > 1){
            itemView.findViewById(R.id.txtCommentMore).setVisibility(View.VISIBLE);
            itemView.findViewById(R.id.txtCommentMore).setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    Bundle b = new Bundle();
                    b.putSerializable("list",(ArrayList<EvaGoodsBean.Item>)data);
                    Intent intent = new Intent(activity, EVAGoodsListActivity.class);
                    intent.putExtra(KEY_PARAM,b);
                    activity.startActivity(intent);
                }
            });
        }else{
            itemView.findViewById(R.id.txtCommentMore).setVisibility(View.GONE);
        }
    }

    private void initMatchHeader(final Context context, View itemView, String url) {
        ImageView ivHeader = (ImageView) itemView.findViewById(R.id.ivHeader);
        Picasso.with(context).load(FileUtils.rePath(url)).into(ivHeader);
        itemView.findViewById(R.id.rlBack).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ((Activity)context).finish();
            }
        });
        itemView.findViewById(R.id.rlCart).setVisibility(View.GONE);
        itemView.findViewById(R.id.rlCart).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                UmengShareManager.share((Activity) context, "");
            }
        });
    }

    private void initGoodsBanner(final Activity activity, View itemView,Object obj ) {
        Object[] param = (Object[]) obj;
        List<GoodsBean.Image> data = (List<GoodsBean.Image> )param[0];
        View.OnClickListener listener = (View.OnClickListener) param[1];
        int num = (int) param[2];
        if (data == null){
            return;
        }
        BannerView bv = (BannerView) ((RelativeLayout)itemView).getChildAt(0);
        List<HashMap<String,Object>> imgList = new ArrayList<>();
        for (int i = 0,max = data.size();i < max;i++){

            HashMap<String,Object> map = new HashMap<>();
            map.put("img",FileUtils.rePath(data.get(i).getUrl()));
            final String link = data.get(i).getUrl();
            map.put("action", new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                }
            });
            imgList.add(map);
        }
        bv.initAdapterData(imgList);
        bv.setDrawerMode(BannerView.STYLE_Dot);
        bv.setLocationMode(BannerView.MODE_CENTER);
        itemView.findViewById(R.id.rlBack).setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View v) {
                activity.finish();
            }
        });
        View ivShoppingCart = itemView.findViewById(R.id.ivShoppingCart);
        if (param[3] != null){
            ivShoppingCart.setVisibility(View.GONE);
        }

        QBadgeView messageQbv = new QBadgeView(activity);
        messageQbv.bindTarget(itemView.findViewById(R.id.rlCart)).setBadgeGravity(Gravity.TOP | Gravity.END);
        messageQbv.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(activity,MainActivity.class);
                intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                ConfigValue.hasRegisterReceiver = false;
                intent.putExtra(KEY_PAGE,3);
                activity.startActivity(intent);
            }
        });
        if (num > 0){
            messageQbv.setBadgeNumber(num)
                    .setGravityOffset(10,-2, true)
                    .setBadgeTextSize(8, true);
        }else {
            messageQbv.setBadgeText(String.valueOf(num))
                    .setGravityOffset(2, 2, true)
                    .setBadgeTextSize(8, true)
                    .hide(false);
        }

    }

    private void initGoodsDetail(View itemView, Object[] param) {
        GoodsBean.Data data = (GoodsBean.Data) param[0];
        TextView txtOldPrice = (TextView) itemView.findViewById(R.id.txtOldPrice);


        TextView txtGoodsName = (TextView) itemView.findViewById(R.id.txtGoodsName);
        TextView txtRealPrice = (TextView) itemView.findViewById(R.id.txtRealPrice);
        TextView txtRatioPrice = (TextView) itemView.findViewById(R.id.txtRatioPrice);
        txtGoodsName.setText(data.getGoodsName());
        TextView txtPrice = (TextView) itemView.findViewById(R.id.txtPrice);

        TextView txtSoldCount = (TextView) itemView.findViewById(R.id.txtSoldCount);
        txtSoldCount.setText(String.valueOf(data.getSoldCount()));
        double price = 0;
        String unit = data.getUnit();
        if (TextUtils.isEmpty(unit)){
            unit = "";
        }else if (TextUtils.equals("元",unit)){
            unit = "";
        }else if (!unit.contains("元")){
            unit = String.format("元/%s",unit);
        }
        if (data.getIsSale() == 1){
            price = data.getSalePrice();

            txtOldPrice.setText(String.format("%.2f %s",data.getBasePrice(),unit));
            txtOldPrice.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG);
        }else{
            price = data.getBasePrice();
            txtOldPrice.setVisibility(View.GONE);
        }

        txtPrice.setText(String.format("%.2f %s",  price,unit));
        if (data.getRatio() != null){
            double ratio = -1;
            try {
                ratio = Double.parseDouble(data.getRatio());
            }catch (Exception e){
                ratio = -1;
            }

            if (ratio > 0){
                txtRatioPrice.setText(String.format("%.2f", (ratio * price )));
                txtRealPrice.setText(String.format("%.2f", (price - ratio * price )));
            }else{
                itemView.findViewById(R.id.panelRatio).setVisibility(View.GONE);
            }
        }

        itemView.findViewById(R.id.btnParam).setOnClickListener((View.OnClickListener) param[1]);
    }

    private void initWeb(View itemView, String data) {
        if (data == null){
            return;
        }
        WebView wvGoods = (WebView) itemView;
        WebSettings mSetting = wvGoods.getSettings();
        mSetting.setJavaScriptEnabled(true);
        mSetting.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
        wvGoods.setWebChromeClient(new WebChromeClient());
        wvGoods.setWebViewClient(new WebViewClient(){});
        if (data.indexOf("http") == 0){
            wvGoods.loadUrl(data);
        }else{
            String css = "<style>img{width:100%;}body{word-wrap:break-word;}</style>";
            data = css + data;
            wvGoods.loadDataWithBaseURL(null,data,"text/html", "UTF-8", null);
        }

    }

    private void initRecommend(Activity activity, View itemView, List<MatchBean.Goods> data, final int type) {
        if (type > 0){
            itemView.findViewById(R.id.rlHeader).setVisibility(View.GONE);
            itemView.setBackgroundColor(Color.WHITE);
        }else {
            itemView.setBackgroundColor(Color.rgb(0xf8, 0xf8, 0xf8));
        }


        MyGridView gvGoodsRecommend = (MyGridView) itemView.findViewById(R.id.gvGoodsRecommend);
        GoodsListAdapter gvadapter = (GoodsListAdapter) gvGoodsRecommend.getAdapter();
        if (gvadapter == null || type == -1){
            gvadapter = new GoodsListAdapter(activity, data,type);
            gvGoodsRecommend.setAdapter(gvadapter);
        }else{
            gvadapter.addAll(data);
        }


        String typegoods = (String) itemView.getTag(R.id.decode);
        if (typegoods!=null){
            gvadapter.setGoodsType(typegoods);
        }
    }

    private void initRecommend(Activity activity, View itemView,List<MatchBean.Goods> data){
        initRecommend(activity,itemView,data,0);
    }
}
